package com.first.sso.service.Impl;

import cn.hutool.crypto.digest.DigestUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.first.common.pojo.TbMember;
import com.first.sso.mapper.MemberMapper;
import com.first.sso.service.SsoLogin;
import com.first.sso.vo.QianLoginVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: finrsteducation-parent
 * @description:
 * @author: 张玉森
 * @create: 2023-05-31 17:30
 **/
@Service
public class SsoLoginImpl implements SsoLogin {
    @Autowired
    private MemberMapper memberMapper;

    @Override
    public TbMember qianLogin(QianLoginVo qianLoginVo) {
        QueryWrapper<TbMember> wrapper = new QueryWrapper<>();
        wrapper.eq("mobile", qianLoginVo.getMobile());
        String password = qianLoginVo.getQianPassword();
        wrapper.eq("password", DigestUtil.md5Hex(password));
        wrapper.eq("is_deleted",0);
        TbMember tbMember = memberMapper.selectOne(wrapper);
        return tbMember;
    }
}
